import React from 'react';
import ReactDOM from 'react-dom';
class App extends React.Component {
    constructor() {
        super();
        this.www = React.createRef()
    }
    /* 
      ref = 'xxx'  this.refs.xxx  将来会被废弃
      ref = {(el)=>{this.xxx =  el}}  this.xxx
      this.xxx = React.createRef();  ref = {this.xxx}  this.xxx.current
    */
    fn(){
      console.log(this.qqq)
      console.log(this.www)
    }
    render() {
        return <div className=''>
              <button onClick={()=>{this.fn()}}>按钮</button>
              <h1 ref={(el)=>{this.qqq = el}}>hello</h1>
              <h1 ref={this.www}>world</h1>
        </div>;
    }
}

ReactDOM.render(<App/>,document.getElementById('root'))